<?php
# autor Marek Křivan
# (c) 2009

echo '<link rel="stylesheet" type="text/css" href="../components/com_forum/templates/styl.css" media="screen" />';

function orez_retezec($retezec) {
                $retezec = trim(strip_tags(strtolower($GLOBALS['db']->real_escape_string($retezec))));
                return $retezec;
        }              
function orez_retezec_2($retezec) {
                $retezec = strip_tags($GLOBALS['db']->real_escape_string($retezec));
                return $retezec;
        }
function overeni_vyplneni($promenna, $nazev) {
                $vysledek = "";
                if(empty($promenna)) { $vysledek = "&nbsp;- povinné pole <b>".$nazev."</b> nebylo vyplněno<br />"; }
                return $vysledek;
        }
        
echo '<h1>Správce fóra</h1><br />';

if (empty($_GET['a'])) {
    
    echo '
	<img src="../libs/icons/application_edit.png" />
<input type="button" onclick="window.location.href=\'' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] .'&a=konfigurace\'" value="Konfigurace fóra" /><br /><br />';

echo '
<img src="../libs/icons/application_form.png" />
<input type="button" onclick="window.location.href=\'' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] .'&a=pridat_obsah\'" value="Přidat obsah" /><br /><br />';

echo '
<img src="../libs/icons/stop.png" />
<input type="button" onclick="window.location.href=\'' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] .'&a=ban_ip\'" value="Ban IP adres" /><br /><br />';


echo '<h2>Statistiky</h2>';

$count_topic = $GLOBALS['db']->query("SELECT COUNT(id) FROM ".$GLOBALS['db_prefix']."forum_prispevky");
$count_topic = $GLOBALS['db']->fetch_array($count_topic);

$count_theme = $GLOBALS['db']->query("SELECT COUNT(id) FROM ".$GLOBALS['db_prefix']."forum_fora");
$count_theme = $GLOBALS['db']->fetch_array($count_theme);

$count_group = $GLOBALS['db']->query("SELECT COUNT(id) FROM ".$GLOBALS['db_prefix']."forum_skupiny");
$count_group = $GLOBALS['db']->fetch_array($count_group);

echo '<p>Celkem skupin : <strong>'.(int)$count_group[0].'</strong></p>'; 
echo '<p>Celkem fór : <strong>'.(int)$count_theme[0].'</strong></p>';
echo '<p>Celkem příspěvků : <strong>'.(int)$count_topic[0].'</strong></p>';



} else {
    switch ($_GET['a']) {
     case 'konfigurace':
            require 'konfigurace.php';
            break;
            
        case 'pridat_obsah':
            require 'pridat_obsah.php';
            break;

        case 'ban_ip':
            require 'ban_ip.php';
            break;

    }
}
?>